<?php
/*
 * Created by generator
 *
 */

class EditSituation extends Controller {

	function EditSituation(){
		parent::Controller();
		$this->load->model('Situation_model');
		$this->load->library('session');
		$this->load->helper('url');
	}


	/**
	 * Affichage des infos
	 */
	public function index($sitidsit){
		$model = Situation_model::getSituation($this->db, $sitidsit);
		$data['situation'] = $model;

		$this->load->view('editsituation_view',$data);
	}

	/**
	 * Sauvegarde des modifications
	 */
	public function save(){
		// Mise a jour des donnees en base
		$model = new Situation_model();
		$model->sitidsit = $this->input->post('sitidsit');
		$model->sitlbnom = $this->input->post('sitlbnom'); 
		$model->update($this->db);

		$this->session->set_flashdata('message', 'Situation mis a jour');

		redirect('listsituations/index'); 
	}
	
}
?>
